From 3b350463afaa3aae3728b3f42b4c84b4566650a4 Mon Sep 17 00:00:00 2001 From: Carlhuda Date: Wed, 19 Mar 2014 18:25:14 -0700 Subject: [PATCH] Integration tests working Next up: cleanup --- Makefile | 2 +- libs/hamcrest-rust | 2 +- tests/test_cargo_compile.rs | 25 +++++++++++++++++++++++++ tests/tests.rs | 1 + 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 99b7559f8..ddbf0d1f8 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ $(HAMMER): $(wildcard libs/hammer.rs/src/*.rs) $(TOML): $(wildcard libs/rust-toml/src/toml/*.rs) cd libs/rust-toml && make -$(HAMCREST): $(wildcard libs/hamcrest-rust/src/*.rs) +$(HAMCREST): $(wildcard libs/hamcrest-rust/src/hamcrest/*.rs) cd libs/hamcrest-rust && make # === Cargo diff --git a/libs/hamcrest-rust b/libs/hamcrest-rust index 95f531ad8..39f006244 160000 --- a/libs/hamcrest-rust +++ b/libs/hamcrest-rust @@ -1 +1 @@ -Subproject commit 95f531ad8c726a832f28d171bde2860c77ec7619 +Subproject commit 39f00624492fd648631041eadf1301a08cd2a482 diff --git a/tests/test_cargo_compile.rs b/tests/test_cargo_compile.rs index 48690aa3b..d4a1aab01 100644 --- a/tests/test_cargo_compile.rs +++ b/tests/test_cargo_compile.rs @@ -1,7 +1,31 @@ use std; use support::project; +use hamcrest::{SelfDescribing,Description,Matcher,assert_that}; use cargo; +#[deriving(Clone,Eq)] +pub struct ExistingFile; + +impl SelfDescribing for ExistingFile { + fn describe_to(&self, desc: &mut Description) { + desc.append_text("an existing file"); + } +} + +impl Matcher for ExistingFile { + fn matches(&self, actual: &Path) -> bool { + actual.exists() + } + + fn describe_mismatch(&self, actual: &Path, desc: &mut Description) { + desc.append_text(format!("`{}` was missing", actual.display())); + } +} + +pub fn existing_file() -> ExistingFile { + ExistingFile +} + fn setup() { } @@ -39,6 +63,7 @@ test!(cargo_compile_with_explicit_manifest_path { Err(e) => println!("err: {}", e) } + assert_that(p.root().join("target/foo/bar"), existing_file()); assert!(p.root().join("target/foo").exists(), "the executable exists"); let o = cargo::util::process("foo") diff --git a/tests/tests.rs b/tests/tests.rs index 9e51bc559..3c74087d7 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -2,6 +2,7 @@ #[allow(deprecated_owned_vector)]; extern crate cargo; +extern crate hamcrest; macro_rules! test( ($name:ident $expr:expr) => ( -- 2.30.2